package com.pool;

import java.util.Date;

public class Main {
	
    public static final int fps = 60;
    
	public static void main(String[] args) {
		Window window = new Window();
		
		long startTime, sleepTime;
		int itterationTime = 1000 / fps;
		
		while (true) {
			startTime = new Date().getTime();
			window.invalidate();
			sleepTime = itterationTime - (new Date().getTime() - startTime);
			
			if (sleepTime > 0) {
			    try {
			        synchronized (window) {	
			            window.wait();
			        }
			    } catch (InterruptedException e) {
			        // Got interrupt signal
			    }
			}
		}
		
	}
	
}
